package chips440.tiles;

import java.applet.Applet;
import java.applet.AudioClip;
import java.awt.image.BufferedImage;
import chips440.internals.Player;
import chips440.main.Types;

/**
 * Moves the player in the given direction if he does not have movement
 * boots. int direction is the direction the player would be moved. images
 * for this tile are named "move<direction number>.gif"
 *
 * @author Ryan Hofler
 * @version 0.1
 */
public class MoveTile extends Tile{
    private Types.Direct direction;
	private AudioClip move;

    /**
     * Make a new MoveTile that move the player in the given direction if he's
     * not wearing move boots.
     *
     * @param dir the direction the tile should move the player
     */
    public MoveTile(Types.Direct dir){
        this.direction = dir;
	this.image = chips440.main.ResourceCache.getImage("move_" + this.direction);
	this.move = chips440.main.ResourceCache.getSound("MOVE.WAV");
    }

    public Types.TileAct okToStep(Player player){
        if(player.hasItem(Types.Item.M_BOOT))
            return Types.TileAct.MOVE;
	    move.play();
        return Types.TileAct.GOTO;
    }

    /**
     * get the direction that this tile moves players.
     *
     * @return an int which is one of UP, DOWN, LEFT, RIGHT
     */
    public Types.Direct getDirection(){
        return this.direction;
    }
}
